package com.ljs.springloopdependencies.config;

import com.ljs.springloopdependencies.bean.Book;
import com.ljs.springloopdependencies.bean.Book1;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

@Configuration
public class CreateBean {
    @Bean("Book1")
    public Book1 getBook(){
        Book1 book1=new Book1();
        book1.setBname("bean2");
        book1.setBauthor("ljs");
        System.out.println("配置使用属性"+book1);
        return  book1;
    }
    @PostConstruct
    public void dos() {
        System.out.println("book 准备在执行");
    }
    /**
     * 初始化方法
     * */
    @PreDestroy
    public void myInit() {
        System.out.println("book 准备销毁");
    }


}
